<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>学生课表</title>
</head>
<body>
    <table border="1">
        <tr>
			<th width="70" height="28" align="center"></th>
			<th width="123" height="28" align="center">星期一</th>
			<th width="123" height="28" align="center">星期二</th>
			<th width="123" height="28" align="center">星期三</th>
			<th width="124" height="28" align="center">星期四</th>
			<th width="124" height="28" align="center">星期五</th>
			<th width="124" height="28" align="center">星期六</th>
			<th width="124" height="28" align="center">星期日</th>
		</tr> 

    <?php
        $num = 0;
        $maxnum = count($classtable);
        //var_dump($classtable[$num]->id);
        for ($i = 1; $i <= 6; $i++){
            echo "<tr>";
            $rh = sprintf("<th width=\"70\" height=\"28\" align=\"center\">%d-%d</th>", 2*$i-1, 2*$i);
            echo $rh;
            for ($j = 1; $j <= 7; $j++){
                $showstr = "";
                if ($num < $maxnum){
                    sscanf($classtable[$num]->number,"%d:%d-%d", $w, $n, $m);
                    if ($w == $j && 2*$i == $m){
                        $showstr = sprintf("%s</br>%s</br>%s</br>%s", $classtable[$num]->classname, $classtable[$num]->teacher, $classtable[$num]->week, $classtable[$num]->classroom);
                        $num++;
                    }
                }
                echo "<td width=\"123\" height=\"28\" align=\"center\" valign=\"top\">";
                echo $showstr  ;
                echo "</td>";
            }
            echo "</tr>";
        }
    //var_dump($classtable);
    ?>

    </table>
</body>
</html>
